package com.wsoft.config;

import com.wsoft.interceptor.FileUploadInterceptor;
import com.wsoft.interceptor.HrPmInterceptor;
import com.wsoft.interceptor.SysLogInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @Author z001
 * @Date 2024/10/15 18:25
 */
@Configuration
public class WebConfig  implements WebMvcConfigurer {

    @Autowired
    private FileUploadInterceptor fileUploadInterceptor;
    @Resource
    private SysLogInterceptor sysLogInterceptor;
    @Resource
    private HrPmInterceptor hrPmInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //配置人力绩效拦截器
        registry.addInterceptor(hrPmInterceptor)
                //拦截绩效模块路径
                .addPathPatterns("/hr/pm/**");
        //配置上传自定义拦截器
        registry.addInterceptor(fileUploadInterceptor)
                //拦截所有路径
                .addPathPatterns("/**");
        //配置系统日志拦截器
        registry.addInterceptor(sysLogInterceptor)
                .addPathPatterns("/**");
    }
}
